<template>
  <el-container class="layout-page">
    <el-header>
      <div class="img">
        <img
          src="http://likede2-admin.itheima.net/img/logo.3673fab5.png"
          alt=""
        />
      </div>
      <div>
        <div class="user">
          <el-avatar
            src=""
          ></el-avatar>
          <el-link :underline="false"><span class="hh">欢迎您,admin</span></el-link>
          <div class="logout">
            <el-popconfirm
              title="你确认退出帝可得平台?"
              @confirm="handleConfirm"
            >
              <template #reference>
                <i title="退出登录"  class="el-icon-caret-bottom" style="font-size:20px;color:white">退出</i>
              </template>
            </el-popconfirm>
          </div>
        </div>
      </div>
    </el-header>
    <!-- 侧边栏 -->
    <el-container>
      <el-aside width="200px" style="background-color:white">
        <el-menu
          class="el-menu-vertical-demo"
          router
          :default-active="$route.path"
          background-color="#fff"
          text-color="#333"
          active-text-color="rgb(95, 132, 255)"
          @open="handleOpen"
          @close="handleClose"
        >
          <el-menu-item index="/article">
            <i class="el-icon-house"></i>
            <span>帝可得</span>
          </el-menu-item>

          <el-submenu>
            <template slot="title">
              <i class="el-icon-date"></i>
              <span>工单管理</span>
            </template>
            <el-menu-item-group>
              <el-menu-item index="/operation">运营工单</el-menu-item>
              <el-menu-item index="1-2">运维工单</el-menu-item>
            </el-menu-item-group>
          </el-submenu>

          <el-submenu index="1">
            <template slot="title">
              <i class="el-icon-map-location"></i>
              <span>点位管理</span>
            </template>
            <el-menu-item-group>
              <el-menu-item index="1-1">区域管理</el-menu-item>
              <el-menu-item index="1-2">点位管理</el-menu-item>
              <el-menu-item index="1-2">合作商管理</el-menu-item>
            </el-menu-item-group>
          </el-submenu>

          <el-submenu index="2">
            <template slot="title">
              <i class="el-icon-mobile"></i>
              <span>设备管理</span>
            </template>
            <el-menu-item-group>
              <el-menu-item index="1-1">设备管理</el-menu-item>
              <el-menu-item index="1-2">设备状态</el-menu-item>
              <el-menu-item index="1-2">设备类型管理</el-menu-item>
            </el-menu-item-group>
          </el-submenu>

          <el-submenu index="3">
            <template slot="title">
              <i class="el-icon-user"></i>
              <span>人员列表</span>
            </template>
            <el-menu-item-group>
              <el-menu-item index="1-1">人员列表</el-menu-item>
              <el-menu-item index="1-2">人效统计</el-menu-item>
              <el-menu-item index="1-2">工作量列表</el-menu-item>
            </el-menu-item-group>
          </el-submenu>

          <el-submenu index="4">
            <template slot="title">
              <i class="el-icon-shopping-cart-1"></i>
              <span>商品管理</span>
            </template>
            <el-menu-item-group>
              <el-menu-item index="1-1">商品类型</el-menu-item>
              <el-menu-item index="1-2">商品管理</el-menu-item>
            </el-menu-item-group>
          </el-submenu>
          <el-menu-item index="5">
            <i class="el-icon-postcard"></i>
            <span>策略管理</span>
          </el-menu-item>
          <el-menu-item index="1">
            <i class="el-icon-coin"></i>
            <span>订单管理</span>
          </el-menu-item>
          <el-menu-item index="1">
            <i class="el-icon-coin"></i>
            <span>对账统计</span>
          </el-menu-item>
        </el-menu>
      </el-aside>
      <el-main>
        <router-view></router-view>
      </el-main>
    </el-container>
  </el-container>
</template>

<script>
export default {
  name: "LayoutIndex",
  data() {
    return {
      username: "",
      avatar: "",
    };
  },
  async created() {},
  methods: {
    handleOpen(key, keyPath) {
      console.log(key, keyPath);
    },
    handleClose(key, keyPath) {
      console.log(key, keyPath);
    },
    handleConfirm() {
      this.$store.commit("user/logout");
      this.$router.push("/login");
    },
  },
};
</script>

<style lang="scss" scoped>
.layout-page {
  height: 100vh;
  .el-aside {
    background: #f8fafd;
    .logo {
      color: #fff;
      font-size: 20px;
      height: 60px;
      line-height: 60px;
      text-align: center;
    }
    .el-menu {
      border-right: none;
      margin-top: 20px;
      background-color: #fff;
      &-item {
        background-color: transparent !important;
      }
      span{
        margin-left: 20px;
        font-size: 18px; 
      }
      .el-menu-item{
        font-size:16px;
         color: #999;
      }
    }
  }
  .el-header {
    box-shadow: 0px 0px 35px 0px rgba(154, 161, 171, 0.15);
    background-image: url();
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 999;
    .img {
      display: flex;
      height: 35px;
      margin-top: 15px;
      margin-left: 15px;
    }
  }
  .user {
    display: flex;
    align-items: center;
    height: 60px;
    padding: 0 15px;
    .hh{
      color: white;
      font-size: 18px;
    }
    .el-avatar {
      margin-right: 15px;
    }
    .logout {
      font-size: 20px;
      color: #999;
      cursor: pointer;
      padding: 0 15px;
    }
  }
  .el-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: #aaa;
    border-top: 1px solid rgba(152, 166, 173, 0.2);
    font-size: 14px;
  }
}
</style>
